home *** CD-ROM | disk | FTP | other *** search
- package asp.wizard;
-
- import asp.netobjects.nfx.ui.OrderedListModel;
- import asp.netobjects.nfx.wizard.WizardPageView;
- import asp.wizard.util.UiUtil;
- import com.sun.java.swing.DefaultListModel;
- import com.sun.java.swing.JComboBox;
- import com.sun.java.swing.JComponent;
- import com.sun.java.swing.JTextArea;
- import com.sun.java.swing.ListModel;
- import java.awt.Component;
- import java.util.TooManyListenersException;
-
- public class WizardViewSubDbQuerySelect extends WizardViewAbstract {
- private static WizardViewAbstract _instance = null;
- private WVPanelDbQuerySelect _mainPanel;
- private SubDBQueryData _Data;
- private boolean _updatingTableComboBox = false;
-
- public static WizardViewAbstract getInstance() {
- if (_instance == null) {
- _instance = new WizardViewSubDbQuerySelect();
- }
-
- return _instance;
- }
-
- public WizardViewSubDbQuerySelect() {
- this.initListeners();
- }
-
- private void initListeners() {
- this._mainPanel._cboTables.addItemListener(new 1(this));
-
- try {
- this._mainPanel._l2lProjections.addListToListXferItemListener(new 2(this));
- } catch (TooManyListenersException e) {
- System.err.println(((Throwable)e).getMessage());
- }
-
- }
-
- private Object handleGetItemToXfer(Object sourceItem) {
- Object result = null;
- WizardModelSubDbQuerySelect model = (WizardModelSubDbQuerySelect)((WizardPageView)this).getModel();
- if (model != null) {
- String value = model.handleGetItemToXfer(sourceItem).toString();
- if (!UiUtil.valueExistsInListModel((DefaultListModel)this._mainPanel._l2lProjections.getRightList().getModel(), value)) {
- result = value;
- }
- }
-
- return result;
- }
-
- protected void createMainPanel() {
- this._mainPanel = new WVPanelDbQuerySelect();
- }
-
- public WVPanelBase getMainPanel() {
- return this._mainPanel;
- }
-
- public JComboBox getTableCombo() {
- return this._mainPanel._cboTables;
- }
-
- public String getSelectedTable() {
- return (String)this._mainPanel._cboTables.getSelectedItem();
- }
-
- public void setAvailableFieldModel(ListModel lm) {
- this._mainPanel._l2lProjections.setLeftListModel(lm);
- }
-
- public void selectField(int i) {
- this._mainPanel._l2lProjections.getLeftList().setSelectedIndex(0);
- }
-
- public OrderedListModel getFields() {
- return (OrderedListModel)this._mainPanel._l2lProjections.getRightList().getModel();
- }
-
- public void setSelectedFields(ListModel olm) {
- this._mainPanel._l2lProjections.getRightList().setModel(olm);
- }
-
- public void setTableComboBoxModel(OrderedListModel comboModel) {
- this._updatingTableComboBox = true;
-
- try {
- UiUtil.populateCombo(this.getTableCombo(), comboModel);
- if (((DefaultListModel)comboModel).getSize() > 0) {
- this.getTableCombo().setSelectedIndex(0);
- }
- } finally {
- this._updatingTableComboBox = false;
- }
-
- }
-
- public void setContainingSpaceWarningVisible(boolean visible) {
- JTextArea txa = this._mainPanel._txaContainingSpaceWarning;
- if (visible && !((Component)txa).isVisible()) {
- ((JComponent)txa).setVisible(true);
- } else if (!visible && ((Component)txa).isVisible()) {
- ((JComponent)txa).setVisible(false);
- }
-
- }
-
- // $FF: synthetic method
- static boolean access$0(WizardViewSubDbQuerySelect $0) {
- return $0._updatingTableComboBox;
- }
-
- // $FF: synthetic method
- static Object access$1(WizardViewSubDbQuerySelect $0, Object $1) {
- return $0.handleGetItemToXfer($1);
- }
- }
-